<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@page import="login.User"
        import="java.util.HashMap"
        import="java.lang.String"
        import="application.Seed"%>
<%@ include file="WEB-INF/jspf/header.jspf" %>  
<% User currentUser = (User) session.getAttribute("currentSessionUser"); %>
    <h3>Welcome
    <%
    String newRegister = request.getParameter( "registerAttempt" );
    if ( newRegister != null )
    {
    %>
    , You Successfully Registered!
    <%
    }
    %>   
    </h3>
    <div class="homeDiv">
        Latest sales listed below<br/><br/>
        <sql:query var="latestSales" dataSource="jdbc/CS2340SeedSwap">
            SELECT * FROM seeds 
            ORDER BY ID DESC
            LIMIT 5;
        </sql:query>
        
        <table border="1">
            <!-- column headers -->
            <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Scientific Name</th>
                <th>Growing Tips</th>
                <th>Special Requirements</th>
                <th>Harvesting Information</th>
                <th>Growing Season</th>
                <th>Climate Zone</th>
                <th>Hardiness</th>
                <th>Seller's Username</th>
                <th>Quantity (kg.)</th>
                <th>Price</th>
            </tr>
            <!-- column data -->
            <c:forEach var="row" items="${latestSales.rowsByIndex}">
                <tr>
                <c:forEach var="column" items="${row}">
                    <td><c:out value="${column}"/></td>
                </c:forEach>
                </tr>
            </c:forEach>
        </table>
    </div>
<%@ include file="WEB-INF/jspf/footer.jspf" %>